home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7710 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: seaeagle.csi.cam.ac.uk!ag129
  2. From: ag129@ucs.cam.ac.uk (A. Grant)
  3. Newsgroups: comp.lang.pl1,comp.lang.c
  4. Subject: Re: PL/I and C
  5. Date: Wed, 28 Feb 1996 11:37:33
  6. Organization: University of Cambridge
  7. Message-ID: <ag129.154.000BA099@ucs.cam.ac.uk>
  8. References: <4gh5ru$eng@goanna.cs.rmit.EDU.AU> <4grhtv$s31@goanna.cs.rmit.EDU.AU> <4gt0tv$826@solutions.solon.com> <4gv8h0$3o2k@news-s01.ny.us.ibm.net> <4h066c$r0t@solutions.solon.com>
  9. NNTP-Posting-Host: seaeagle.csi.cam.ac.uk
  10.  
  11. In article <4h066c$r0t@solutions.solon.com> seebs@solutions.solon.com (Peter Seebach) writes:
  12. >Are you telling me PL/I can't have a non-fixed length string, dynamically
  13. >allocated?  If it can, the compare or copy functionality will do the same
  14. >thing strcmp() and strcpy() do at some level.  If it can't, it sucks.
  15.  
  16. Actually it won't, since in PL/I the length field is held separately.
  17. It does not have to scan through a string to find its length.
  18. Functions become constant-time rather than linear and many "running 
  19. off the end" errors are avoided.
  20.  
  21. Basically the C str...() functions are provided for students and 
  22. systems programmers.  Anyone doing serious amounts of string handling
  23. in C/C++ defines a string abstract type, or class or whatever, with the 
  24. length field held separately.  Have a look at the implementation of 
  25. strings in the C source of languages like Perl, Icon and Rexx.  
  26.